<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        #a {
            width: 500px;
            height: 200px;
            position: absolute;
            left: 500px;
            top: 200px;
            padding-top: 100px;
            background-color: pink;
            border: 1px black solid;
            text-align: center;
        }

        #no {
            position: absolute;
            left: 100px;
            top: 100px;
        }
    </style>

</head>

<body>
    <div id="a" clas="a" style="color: red;">
        <span>haha</span><br />
        <button onclick="b()">yes</button> <br />
        <button onmouseover="a()" id="no">no</button>
    </div>
    <script>
        function a() {
            var no = document.getElementById("no");
            no.style.left = Math.floor(Math.random() * 450) + "px";
            no.style.top = Math.floor(Math.random() * 280) + "px";
        }

        function b() {
            alert("哈哈")
        }
    </script>
</body>

</html>